﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script>
        // 复杂数据类型传参
        function Hero(name) {
            this.name = name;
        }

        function change(x) {     // 
            // let x;
            // x = yuji;

            console.log(x.name); // 虞姬     

            console.log(x.name); //  虞姬     

            x.name = "貂蝉";
            console.log(x.name); // 貂蝉 
        }
        var yuji = new Hero("虞姬");
        console.log(yuji.name); //虞姬    
        change(yuji);
        console.log(yuji.name); //貂蝉  
    </script>
</body>
</html>